/*
 * Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef SLE_SEEK_HDI_H
#define SLE_SEEK_HDI_H

#include "sle_hal_errcode.h"
#include "sle_seek_config.h"

/**
 * @brief Callback invoked when seek enabled.
 * 
 * @param [in] errCode error code.
 * @return #void no return value.
 */
typedef void (*SleHdiStartSeekCallback)(SleHdiErrorCode errCode);

/**
 * @brief Callback invoked when scan disabled.
 * 
 * @param [in] errCode error code.
 * @return #void no return value.
 */
typedef void (*SleHdiStopSeekCallback)(SleHdiErrorCode errCode);

/**
 * @brief Callback invoked when receive seek data.
 * 
 * @param [in] seekResultData seek result.
 * @return #void no return value.
 */
typedef void (*SleHdiSeekResultCallback)(const SleSeekResult *seekResultData);

/**
 * @brief Struct of SLE device seek callback function.
 */
typedef struct {
    SleHdiStartSeekCallback OnSeekStartCb;                 /*!< @if Eng scan enable callback.
                                                                 @else   扫描使能回调函数。 @endif */
    SleHdiStopSeekCallback OnSeekStopCb;              /*!< @if Eng scan disable callback.
                                                                 @else   扫描关闭回调函数。 @endif */
    SleHdiSeekResultCallback OnSeekResultCb;                /*!< @if Eng scan result callback.
                                                                 @else   扫描结果回调函数。 @endif */
} SleSeekHdiCallbacks;

/**
 * @brief Use this funtion to set device seek parameter.
 * 
 * @param  [in] param device device seek parameter.
 * @return error code.
 */
typedef SleHdiErrorCode (*SleHdiSetSeekParam)(const SleSeekParam *param);

/**
 * @brief Use this funtion to start device seek.
 * 
 * @param  NULL
 * @return error code.
 */
typedef SleHdiErrorCode (*SleHdiStartSeek)(void);

/**
 * @brief Use this funtion to stop device seek.
 * 
 * @param  NULL
 * @return error code.
 */
typedef SleHdiErrorCode (*SleHdiStopSeek)(void);

/**
 * @brief  Register SLE device deviceSeek callbacks.
 * 
 * @param [in] seekCallbacks Callback function.
 * @return error code.
 */
typedef SleHdiErrorCode (*SleHdiRegisterSeekCallbacks)(SleSeekHdiCallbacks *seekCallbacks);

/**
 * @brief Struct of seek module function.
 */
typedef struct {
    SleHdiStartSeek startSeek;                             /*!< @if Start device seek.
                                                              @else   开始设备扫描。 @endif */
    SleHdiStopSeek stopSeek;                               /*!< @if Stop device seek.
                                                              @else   停止设备扫描。 @endif */
    SleHdiSetSeekParam setSeekParam;                       /*!< @if Set device seek parameter.
                                                              @else   设置设备扫描参数。 @endif */
    SleHdiRegisterSeekCallbacks registerSeeCbks;  /*!< @if Register device seek callbacks.
                                                              @else   注册设备扫描回调函数。 @endif */
} SleSeekHdiOpts;

/**
 * @brief  sle_adapter_hdi.c调用此函数初始化SleHostHdiOpts。
 * 
 * @par    从sdk中获取hdi总接口函数集。
 * @param  [out] hostOpts    sle host接口函数集。
 * @return SleHdiErrorCode
**/
SleHdiErrorCode GetSleSeekHdiOpts(SleSeekHdiOpts *seekOpts);
#endif // SLE_SEEK_HDI_H